INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})

FILE(GLOB WORDS_DIC_SRC *.cpp *.h *.rc *.rc2)

SOURCE_GROUP("" FILES ${WORDS_DIC_SRC})

SET(WORDS_DIC_HDR words_dicDlg.h)
SET(WORDS_DIC_UIS words_dic_Qt.ui)
SET(WORDS_DIC_RCS words_dic_Qt.qrc)

ADD_DEFINITIONS(-DNL_WORDS_DIC_CFG="${NL_ETC_PREFIX}/")

IF(WITH_QT)
  INCLUDE_DIRECTORIES(${QT_INCLUDES})
  INCLUDE(${QT_USE_FILE})

  SET(QT_USE_QT3SUPPORT TRUE)
  SET(QT_USE_QTXML TRUE)

  QT4_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS})
  QT4_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS})
  QT4_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR})

  ADD_DEFINITIONS(${QT_DEFINITIONS})
ELSE()
  QT5_ADD_RESOURCES(WORDS_DIC_RC_SRCS ${WORDS_DIC_RCS})
  QT5_WRAP_UI(WORDS_DIC_UI_HDRS ${WORDS_DIC_UIS})
  QT5_WRAP_CPP(WORDS_DIC_MOC_SRCS ${WORDS_DIC_HDR})
ENDIF()

ADD_EXECUTABLE(words_dic_qt WIN32 ${WORDS_DIC_SRC} ${WORDS_DIC_MOC_SRCS} ${WORDS_DIC_RC_SRCS} ${WORDS_DIC_UI_HDRS})

TARGET_LINK_LIBRARIES(words_dic_qt ${QT_LIBRARIES} nelmisc)
NL_DEFAULT_PROPS(words_dic_qt "NeL, Tools, Misc: Qt Words Dic")
NL_ADD_RUNTIME_FLAGS(words_dic_qt)

INSTALL(TARGETS words_dic_qt RUNTIME DESTINATION ${NL_BIN_PREFIX} COMPONENT toolsmisc)
INSTALL(FILES words_dic.cfg DESTINATION ${NL_ETC_PREFIX} COMPONENT toolsmisc)
